<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
    <title>{block name="title"}{/block}{$settingInfo['siteName']}管理后台</title>
	    <link rel="stylesheet" href="{$domainStatic}/{$assets}/common/css/bootstrap.min.css">
	    <link rel="stylesheet" type="text/css" href="{$domainStatic}/{$assets}/common/css/iview.css">
    <link rel="stylesheet" type="text/css" href="{$domainStatic}/{$assets}/admin/css/admin.css"/>
    <link rel="stylesheet" type="text/css" href="{$domainStatic}/{$assets}/admin/css/main-v2.css"/>
    <link rel="stylesheet" type="text/css" href="{$domain}/{$Think.config.admin}/componentcss"/>
	<link rel="stylesheet" type="text/css" href="{$domain}/{$Think.config.admin}/addons/addonscss"/>
    {block name="style"}
        
    {/block}
</head>
<body class="body-admin">
    <section id="adminWarp">
    	<header class="ssy-admin-header clearfix b-b">
			<div class="admin-logo">
				<a class="admin-logo-link" :href='"{$domain}/{$Think.config.admin}/#/"'>管理系统后台</a>
				<span class="sub-v"></span>
			</div>
			<ul class="header-switch">
				<li><a href='{$domainStatic}' target="_blank" class="link"><Icon type="ios-home-outline"></Icon> 网站前台</a></li>
				<li v-for='item in headerList'>
					<router-link class="link" :to='"/addons/"+item.name+"/"+($route.params.dataId && ($route.params.dataId != "undefined")  ? $route.params.dataId : "")' v-text='item.title'></router-link>
				</li>
			</ul>
	        <div class="admin-user-info" v-cloak>
	            <ul class="nav navbar-nav navbar-right">
	                 <Dropdown trigger="click" >
	                    <a href="javascript:void(0)">
	                        管理员
	                        <Icon type="ios-arrow-down"></Icon>
	                    </a>
	                    <Dropdown-Menu slot="list">
	                        <li class="ivu-dropdown-item" @click='editPassword'>修改密码</li>
	                        <li class="ivu-dropdown-item" @click='loginOut'>安全退出</li>
	                    </Dropdown-Menu>
	                </Dropdown>
	            </ul>
	        </div>
	    </header>
        <main class="admin-container-warp clearfix" >
			<aside id="menu" class="admin-menu hidden-xs">
			   <div class="menu-wrap">
					<div class="menu-content sidebar-menu">
						<ul class="sidebar-list">
							{foreach name='$AdminMenu' id='v'}
								{if condition='$v.html'}
									{$v.html}
								{/if}
							{/foreach}
						</ul>
					</div>
				</div>
			</aside>
			<section class="admin-container">
				<router-view></router-view>
			</section>
          </main>
    </section>
    {block name="dialog"}{/block}
    <div class="error-modal" style="position: fixed;top: 10%;right: 0;bottom: 0;left: 50%;z-index: 99999;display: none;margin-left: -512px;width: 1024px;">
        <div class="error-modal-warp" style="background-color: #fff;border-radius: 4px;">
            <div class="error-modal-title" style="padding-left: 15px;padding-right: 15px;">
                <h3 style="border-bottom: 1px solid #dfe5eb;font-size: 18px;height: 50px;line-height: 50px;">错误500（请截图发送至技术人员）</h3>
                <b class="error-close" style="position:absolute;right: 10px;top: 18px;width: 30px;height: 30px;display: inline-block;text-align: center;cursor: pointer;">X</b>
            </div>
            <div class="error-modal-body" style="padding: 15px;overflow-y: auto;">
                <iframe id="errorModalBody" height="600" style="width: 100%;border: 0;"></iframe>
            </div>
        </div>
    </div>
    <div class="error-modal-bg" style="position: fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 99998;background-color: #000;opacity: 0.5;display: none;"></div>
</body>
{block name="javascript"}
<script type="text/javascript">
    var siteGlobal = {
        domain: '{$domain}',
        rewrite: '{$rewrite}',
        settingInfo: {$siteInfoToJson},
        mod: '{$mod}',
        ctr: '{$ctr}',
        act: '{$act}',
    }
</script>

<script src="{$domainStatic}/{$assets}/common/js/components.js"></script>
<script src="{$domainStatic}/{$assets}/common/js/echarts.min.js"></script>
<script src="{$domainStatic}/{$assets}/common/js/iview.min.js" type="text/javascript" charset="utf-8"></script>
<script src="{$domain}/{$Think.config.admin}/componentjs" type="text/javascript" charset="utf-8"></script>
<script src="{$domain}/{$Think.config.admin}/addons/addonsjs" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="{$domainStatic}/{$assets}/plugin/simditor/styles/simditor.css" />
<link rel="stylesheet" type="text/css" href="{$domainStatic}/{$assets}/plugin/simditor/styles/mini-editor.css"/>
<link rel="stylesheet" type="text/css" href="{$domainStatic}/{$assets}/plugin/simditor/styles/simditor-html.css"/>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/jquery.min.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/module.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/hotkeys.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/uploader.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/simditor.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/simditor-autosave.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/beautify-html.js"></script>
<script src="{$domainStatic}/{$assets}/plugin/simditor/scripts/simditor-html.js"></script>
<script type="text/javascript">
	function randomNum(minNum, maxNum) {
        switch(arguments.length) {
            case 1:
                return parseInt(Math.random() * minNum + 1);
                break;
            case 2:
                return parseInt(Math.random() * (maxNum - minNum + 1) + minNum);
                break;
            default:
                return 0;
                break;
        }
    }

    function formatDate(time, type) {
        if(isNaN(time) || time == null || time == '' || time == undefined) {
            return '';
        }
        var tmpDate = new Date(parseInt(time));
        var year = tmpDate.getFullYear();
        var month = addZero(tmpDate.getMonth() + 1);
        var day = addZero(tmpDate.getDate());
        var hours = addZero(tmpDate.getHours());
        var minutes = addZero(tmpDate.getMinutes());
        var seconds = addZero(tmpDate.getSeconds());
        if(type == 'yyyy年mm月dd日') {
            return year + '年' + month + '月' + day + '日';
        } else if(type == 'yyyy-mm-dd') {
            return year + '-' + month + '-' + day;
        } else if(type == 'yyyy-mm') {
            return year + '-' + month;
        } else if(type == 'hh:mm:ss') {
            return hours + ':' + minutes + ':' + seconds;
        } else if(type == 'hh:mm') {
            return hours + ':' + minutes;
        } else if(type == 'yyyy-mm-dd hh:ss') {
            return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes;
        } else if(type == 'yyyy-mm-dd hh:mm:ss') {
            return year + '-' + month + '-' + day + ' ' + '00:00:00';
        } else {
            return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
        }
    }
    function formatTime(time) {
        var tmpDate = new Date();
        var year = tmpDate.getFullYear();
        var month = addZero(tmpDate.getMonth() + 1);
        var day = addZero(tmpDate.getDate());
        return year + '-' + month + '-' + day + ' ' + time;
    }
    function addZero(time) {
        var d = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09']
        if(parseInt(time) < 10) {
            return d[time]
        } else {
            return time
        }
    }

    function getDayStartTime(time) {
        return Date.parse(new Date(formatDate(Date.parse(time), 'yyyy-mm-dd hh:mm:ss'))) / 1000;
    }
</script>
<script type="text/javascript">
	$(document).ready(function() {
    var animationSpeed = 200;
    $('.sidebar-menu').on('click', 'li.has-sub>a', function(e) {
        e.preventDefault();
        var $this = $(this);
        var nextElem = $(this).next();
        if (nextElem.parent("li").is('.active')) {
            nextElem.css('display','block');
            nextElem.slideUp(animationSpeed, function() {
                //收起
                nextElem.parent("li").removeClass("active");
            });
        } else {
            var subUl = $('.sidebar-menu .has-sub');
            subUl.find('ul:visible').slideUp(animationSpeed, function() {
                //收起
                subUl.removeClass("active");
            });
            nextElem.slideDown(animationSpeed, function() {
                //展开
                nextElem.parent("li").addClass("active");
            });
        }
      });
});
</script>
 

<script type="text/javascript">
    const routes = [
        {foreach name='$AdminMenu' id='v'}
            {if condition='$v.route'}
                {$v.route}
            {/if}
        {/foreach}
      	{foreach id='v' name='$addonsRoutes'}{$v}{/foreach}
    ];
    const router = new VueRouter({
//      mode: 'history',
        base: '/',
        routes
    });
     new Vue({
        router,
        el: '#adminWarp',
        data: {
            sideList: [],
            headerList: [],
            siteInfo: '',
        },
        watch: {
        },
        mounted() {
        	this.getSideList();
            this.getHeaderList();   
        },
        methods: {
			getSideList() {
                this.$ssy.ajax('{$domain}/addons/ApiAdminAddons/getSideList', {
                }).then(res => {
                    if(res.code == 1) {
                        this.sideList = res.data;
                    }
                });
            },
            getHeaderList() {
                 this.$ssy.ajax('{$domain}/addons/ApiAdminAddons/getHeaderList', {
                }).then(res => {
                    if(res.code == 1) {
                        this.headerList = res.data;
                    }
                });
            },
            loginOut() {
           		this.$ssy.ajax('{$domain}/{$Think.config.admin}/ApiAdmin/loginOut', {
	            }).then(res => {
	                if (res.code == 1) {
	                    this.$Message.error(res.msg);
                 		location.href = '{$domainStatic}/index.php?s=/{$Think.config.admin}/';
	                }
	            });
	        },
	        editPassword() {
	        	if (this.$route.params.dataId) {
		            this.$router.push({
		                name: 'user/editAccount', params: { mod:'user',dataId: this.$route.params.dataId}
		            });
	        	} else {
		            this.$router.push({
		                name: 'user/editAccount', params: { mod:'user'}
		            });
	        	}
	        }
        }
    });
    
	iview.Message.config({
	    duration: 1.5
	});
</script>
{/block}

<script type="text/javascript">
    $(document).ready(function(){ 
           $('.error-modal-bg').click(function() {
                document.getElementsByClassName('error-modal-bg')[0].style.display = 'none';
                document.getElementsByClassName('error-modal')[0].style.display = 'none';
           });
           $('.error-close').click(function() {
                document.getElementsByClassName('error-modal-bg')[0].style.display = 'none';
                document.getElementsByClassName('error-modal')[0].style.display = 'none';
           });
    }); 
</script>

</html>